package cn.supermarket.system.service.impl;

import cn.supermarket.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.supermarket.common.entity.system.SysNotice;
import cn.supermarket.system.service.SysNoticeService;
import cn.supermarket.system.mapper.SysNoticeMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice>
    implements SysNoticeService{
    /**
     * 查询公告列表
     *
     * @param notice 公告信息
     * @return 公告集合
     */
    @Override
    public List<SysNotice> selectNoticeList(SysNotice notice)
    {
        LambdaQueryWrapper<SysNotice> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(!StringUtils.isEmpty(notice.getNoticeTitle()),SysNotice::getNoticeTitle,notice.getNoticeTitle());
        lambdaQueryWrapper.eq(!StringUtils.isEmpty(notice.getNoticeType()),SysNotice::getNoticeType,notice.getNoticeType());
        lambdaQueryWrapper.like(!StringUtils.isEmpty(notice.getCreateBy()),SysNotice::getCreateBy,notice.getCreateBy());
        return this.baseMapper.selectList(lambdaQueryWrapper);
    }
}




